<?php 

// No direct access
defined ('_JEXEC') or die();

$option = JRequest::getCmd('option');
$view = JRequest::getCmd('view');
$listOrder = $this->state->get('list.ordering');
$listDirn = $this->state->get('list.direction');

?>

<form action='index.php' method='post' name='adminForm' id='adminForm'>
	<input type="hidden" name="option" value="<?php echo $option; ?>" />
    <input type="hidden" name="task" value="" />
    <input type="hidden" name="view" value="<?php echo $view; ?>" />
    <input type="hidden" name="filter_order" value="<?php echo $listOrder; ?>" />
    <input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>" />
    <input type='hidden' name='boxchecked' value='0'/>
    <?php 
    echo JHtml::_('form.token');
    echo JHTML::_('behavior.modal');
     ?>
    
    <fieldset id='filter-bar'>
		<div class='filter-search fltlft'>
    		<label for='filter_search'><?php echo JText::_('JSEARCH_FILTER_LABEL'); ?></label>
    		<input type='text' name='filter_search' id='filter_search' 
    			value='<?php echo $this->escape($this->state->get('filter.search')); ?>'
    			size="30"/>
    		<button type='submit'><?php echo JText::_('JSEARCH_FILTER_SUBMIT'); ?></button>
    		<button type='button' onclick='document.id("filter_search").value="";this.form.submit();'>
    			<?php echo JText::_('JSEARCH_FILTER_CLEAR'); ?>
    		</button>
    	</div>
    </fieldset>
    
    <div class="clr"> </div>
    
	<div id='editcell'>
		<table class='adminlist'>
			<thead>
				<tr>
					<td><?php echo JHtml::_('grid.sort', 'ID', 'id', $listDirn, $listOrder)?></td>
					<td><?php echo JHtml::_('grid.sort', 'Tên SP', 'product_name', $listDirn, $listOrder)?></td>
					<td>Link</td>
					<td><?php echo JHtml::_('grid.sort', 'Gía web', 'web_price', $listDirn, $listOrder)?></td>
					<td><?php echo JHtml::_('grid.sort', 'Ngày đặt', 'date', $listDirn, $listOrder)?></td>
				</tr>
			</thead>
			<tfoot>
				<tr>
					<td colspan='5' align="center">
						<?php echo $this->pagination->getListFooter(); ?>
					</td>
				</tr>
			</tfoot>
			<tbody>
			<?php
			$k = 0;
			$i = 0;
			foreach ($this->items as $row)
			{
				$checked = JHtml::_('grid.id', $i++, $row->id);
				$link = JRoute::_('index.php?option=' . $option . '&task=order.edit&id=' . $row->id);
			?>
				<tr class="row<?=$k?>">
					<td><?php echo $row->id; ?></td>
					<td>
					<a class="modal" href='#<?php echo $row->id; ?>' rel="{handler: 'clone'}"><?php echo $row->product_name; ?></a>
						<div style="display: none;">
							<div id="<?php echo $row->id?>">
								<table>
									<tr>
										<td>Họ tên</td>
										<td><?php echo JFactory::getUser()->name; ?></td>
									</tr>
									<tr>
										<td>Tên sản phẩm</td>
										<td><?php echo $row->product_name;?></td>
									</tr>
									<tr>
										<td>Link sản phẩm</td>
										<td><?php echo $row->link; ?></td>
									</tr>
									<tr>
										<td>Link hình</td>
										<td><?php echo $row->photo_link; ?></td>
									</tr>
									<tr>
										<td>Màu</td>
										<td><?php echo $row->color; ?></td>
									</tr>
									<tr>
										<td>Size</td>
										<td><?php echo $row->size; ?></td>
									</tr>
									<tr>
										<td>Số lượng</td>
										<td><?php echo $row->quantity; ?></td>
									</tr>
									<tr>
										<td>Gía trên web</td>
										<td><?php echo $row->web_price; ?></td>
									</tr>
									<tr>
										<td>Điện thoại</td>
										<td><?php echo $row->phone; ?></td>
									</tr>
									<tr>
										<td>Ngày đặt</td>
										<td><?php echo $row->date; ?></td>
									</tr>
									<tr>
										<td>Ghi chú</td>
										<td><?php echo $row->note; ?></td>
									</tr>
								</table>
							</div>
						</div>
					</td>
					<td><?php echo $row->link; ?></td>
					<td><?php echo $row->web_price; ?></td>
					<td><?php echo $row->date; ?></td>
				</tr>
			<?php
			$k = 1 - $k;
			}
			?>
			</tbody>
		</table>
	</div>
</form>